package server.business.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import server.business.pojo.BloodComposition;
import server.business.service.BloodCompositionService;
import server.business.mapper.BloodCompositionMapper;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
* @author Galaxy
* @description 针对表【blood_composition(血液成分)】的数据库操作Service实现
* @createDate 2022-11-08 12:46:23
*/
@Service("bloodCompositionService")
public class BloodCompositionServiceImpl extends ServiceImpl<BloodCompositionMapper, BloodComposition>
    implements BloodCompositionService{
    @Autowired
    BloodCompositionService bloodCompositionService;

    /**
     * 查询数据
     *
     * @return {@link List}<{@link BloodComposition}>
     */
    public List<BloodComposition> queryData(){
        List<BloodComposition> list = bloodCompositionService.list();
        return list;
    }


    /**
     * fzx
     * @param BloodComposition
     * @return
     */
    public String getComposition(String BloodComposition) {
        QueryWrapper<BloodComposition> CompositionType= new QueryWrapper<>();
        CompositionType
                .lambda()
                .eq(server.business.pojo.BloodComposition::getCode, BloodComposition)
                .select(server.business.pojo.BloodComposition::getComposition);
        List<Map<String, Object>> list = this.listMaps(CompositionType);
        return ((String) list.get(0).get("composition"));
    }
}




